<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@page import="com.damn.bean.GeneralBean,java.util.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<link rel="SHORTCUT ICON" href="favicon.ico">
<meta name="Description" content="Facebook Post Automator" />
<meta name="Keywords" content="Facebook,Schedule Facebook Post" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta name="Distribution" content="Global" />
<meta name="Author" content="Dhaval Mehta - dmehta17@gmail.com" />

<link rel="stylesheet" href="images/CoolWater.css" type="text/css" />

<title>FBAuto</title>
<script type="text/javascript">
function submitForm(reqType)	{	
	document.FBAutoSubmit.action = '<%=request.getContextPath()%>/FBAuto?action='+reqType;
	document.FBAutoSubmit.submit();	
}
function submitPic(reqType)	{
	document.uploadPic.action = '<%=request.getContextPath()%>/FBAuto?action=uploadPic';
	document.uploadPic.submit();
}
function getChecked()	{	
	var chkList = document.FBAutoSubmit.access;
	var minOneChk = false;
	for(var i = 0;i<chkList.length;i++)	{
		if(chkList[i].checked)	{
			minOneChk = true;
		}
	}
	if(!minOneChk)	{
		alert('Select at least one profile to Post');	
	}	
	return minOneChk;
}
</script>
<%
String uName = (String)session.getAttribute("uName");
ArrayList<GeneralBean> listOfAccess = (ArrayList<GeneralBean>)(request.getSession().getAttribute("listOfAccess"));
String msgStr = (String)request.getAttribute("msgStr");
if(uName != null && !uName.equals("") && listOfAccess != null && listOfAccess.size() > 0)	{
%>
</head>

<body>
<!-- wrap starts here -->
<div id="wrap">
		
	<!--header -->
	<div id="header">			
				
		<h1 id="logo-text"><a href="main.jsp">FB Auto</a></h1>		
			
		<div id="header-links">
			<p>
			<a href="main.jsp">Home</a> | 
			<a href="#" onclick="submitForm('logout');">Logout</a>					
			</p>		
		</div>		
						
	</div>
		
	<!-- navigation -->	
	<div  id="menu">
		<ul>
			<li id="current"><a href="main.jsp">Home</a></li>
			<li><a href="schedulePost.jsp">Schedule Your Posts</a></li>			
			<li><a href="#">About</a></li>		
		</ul>
	</div>					
			
	<!-- content-wrap starts here -->
	<div id="content-wrap">
		
		<div id="main">
			<form name="FBAutoSubmit" action = "FBAuto" method="POST" enctype="multipart/form-data">
				<input type="hidden" name = "count" value ="<%=listOfAccess.size()%>">
				<!-- <div align="Right"><input type="button" onclick="submitForm('logout');" value="Logout"></div>-->				
				<%if(msgStr!= null)	{ %>
				<label style="color: red;text-align: center;"><%=msgStr%></label>
				<%} %>
				<fieldset>
				<legend>Select Profile to Post</legend>
				<table>
				<% 
					
					for(int index = 0;index<listOfAccess.size();index++)	{
						GeneralBean bean = listOfAccess.get(index);
						%>
						<tr>
						<td><input type="checkbox" value="<%=bean.getAccessIndex()%>" name="access"></td>
						<td><%=bean.getAccessName()%></td>
						</tr>
					<%}%>
				</table>
				</fieldset>
				
				<br/>
				
				<fieldset>
				<legend>Post Status</legend>
				<div style="width: 70%;margin-left: 15%">
				<table>
				<tr>
				<td><label>What's on your mind : </label></td>
				<td><input type="text" name = "FBMessage"></td>
				<td></td>
				<td><input class="button" type="button" value = "Post Status" onClick="if(getChecked())submitForm('FBPostMsg')"></td>
				</tr>
				</table>
				</div>
				</fieldset>		
				<br/>
				
				<fieldset>
				<legend>Upload A Photo</legend>
				<div style="width: 70%;margin-left: 15%">
				<table>				
				<tr>
				<td><label>Upload A photo : </label></td>
				<td><input type="file" name="fileIp" class="button"></td>
				</tr>
				
				<tr>
				<td><label>Write Something about this Photo : </label></td>
				<td><input type="text" name="caption"></td>
				</tr>
				
				<tr>				
				<td colspan="2" align="center"><input class="button" type="button" onclick="if(getChecked())submitForm('uploadPic')" value='Post Photo'></td>
				</tr>
				
				</table>
				</div>
				</fieldset>
				
				<br/>
				
				<br/>
				<!-- <a href="schedulePost.jsp" >Schedule Your Posts</a>-->
				
				<p align="center"><a href=""></a></p>
				<br/>
				<br/>
				<%}	else	{
					response.sendRedirect("login.jsp");
				}
				%>
			</form>
			
			<br />	
			
		</div>
		
 			
		<div id="sidebar">
<!-- 			
			<h2>Search Box</h2>	
			<form action="#" class="searchform">
				<p>
				<input name="search_query" class="textbox" type="text" />
				<input name="search" class="button" value="Search" type="submit" />
				</p>			
			</form>	
					
			<h2>Sidebar Menu</h2>
			<ul class="sidemenu">				
				<li><a href="index.html">Home</a></li>
				<li><a href="#TemplateInfo">Template Info</a></li>
				<li><a href="#SampleTags">Sample Tags</a></li>
				<li><a href="http://www.styleshout.com/">More Free Templates</a></li>	
				<li><a href="http://www.4templates.com/?aff=ealigam">Premium Templates</a></li>	
			</ul>	
				
			<h2>Links</h2>
			<ul class="sidemenu">
				<li><a href="http://www.pdphoto.org/">PDPhoto.org</a></li>
				<li><a href="http://www.squidfingers.com/patterns/">Squidfingers</a></li>
				<li><a href="http://www.alistapart.com">Alistapart</a></li>					
				<li><a href="http://www.cssremix.com">CSS Remix</a></li>
				<li><a href="http://www.cssmania/">CSS Mania</a></li>					
			</ul>
			
			<h2>Sponsors</h2>
			<ul class="sidemenu">
				<li><a href="http://www.4templates.com/?aff=ealigam"><strong>4templates</strong></a> <br /> Low Cost Hi-Quality Templates</li>
				<li><a href="http://store.templatemonster.com?aff=ealigam"><strong>TemplateMonster</strong></a> <br /> Delivering the Best Templates on the Net!</li>
				<li><a href="http://tinyurl.com/3cgv2m"><strong>Text Link Ads</strong></a> <br /> Monetized your website</li>
				<li><a href="http://www.fotolia.com/partner/114283"><strong>Fotolia</strong></a> <br /> Free stock images or from $1</li>
				<li><a href="http://www.dreamstime.com/res338619"><strong>Dreamstime</strong></a> <br /> Lowest Price for High Quality Stock Photos</li>
				<li><a href="http://www.dreamhost.com/r.cgi?287326"><strong>Dreamhost</strong></a> <br /> Premium webhosting</li>
			</ul>
				
			<h2>Wise Words</h2>
				
			<p>&quot;To have a quiet mind is to possess one's mind wholly; to have a calm spirit is to 
			possess one's self.&quot; </p>
					
			<p class="align-right">- Hamilton Mabie</p>
			
			<h2>Support Styleshout</h2>
			<p>If you are interested in supporting my work and would like to contribute, you are
			welcome to make a small donation through the 
			<a href="http://www.styleshout.com/">donate link</a> on my website - it will 
			be a great help and will surely be appreciated.</p>
				
		-->			
		</div>
		 
	<!-- content-wrap ends here -->	
	</div>
					
	<!--footer starts here-->
	<div id="footer">
			
		<p>
		&copy; 2012 <strong>FB Auto</strong> | 
		Design by: <a href="http://www.styleshout.com/">styleshout</a> |
		Developed by : <a href="http://www.mehtadhaval.blogspot.com">Dhaval</a>	
   		</p>
				
	</div>	

<!-- wrap ends here -->
</div>

</body>
</html>
